from myapp.models import *
from rest_framework import serializers


# 评论
class CommentSer(serializers.ModelSerializer):
    user_name = serializers.SerializerMethodField()
    def get_user_name(self,obj):
       return obj.user_id.account
    class Meta:
        model = Comment
        fields = "__all__"


# 回复
class CommentReplySer(serializers.ModelSerializer):
    user_name = serializers.SerializerMethodField()
    def get_user_name(self,obj):
       return obj.user_id.account
    class Meta:
        model = CommentReply
        fields = "__all__"


# 展示回复
class CommentShowSer(serializers.ModelSerializer):
    class Meta:
        model = CommentShow
        fields = '__all__'